package com.yww.controller;

import com.yww.entity.EchatsRes;
import com.yww.entity.Results;
import com.yww.entity.ResultsParam;
import com.yww.mapper.EcartsMapper;
import com.yww.mapper.ResultsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class EcartsController {

	@Autowired
	EcartsMapper ecartsService;
	@Autowired
	ResultsMapper rservice;

	@RequestMapping("/getResInfos")
	public Object getResInfos(ResultsParam resultsParam) {

		List<String> name=new ArrayList<String>();
		List<Integer> num1=new ArrayList<Integer>();
		List<Integer> num2=new ArrayList<Integer>();
		List<Integer> num3=new ArrayList<Integer>();
		List<Results> list = rservice.getList2(resultsParam);
		for(Results s:list) {
			System.out.println("1111111111111111111111111");
			name.add(s.getLoginName());
			num1.add(s.getCountNum());
			num2.add(s.getSuccessNum());
			num3.add(s.getDoingNum());
		}
		EchatsRes e = new EchatsRes();
		e.setXData(name);
		e.setYData(num1);
		e.setY1Data(num2);
		e.setY2Data(num3);
		System.out.println("gggggggggggggggggggggggggggggggg"+e);
		return e;
	}

	@RequestMapping("/getintInfos")
	public Object getintInfos() {
		List<String> name = ecartsService.getintName();
		List<Integer> nums = ecartsService.getintNum();
		EchatsRes e = new EchatsRes();
		e.setXData(name);
		e.setYData(nums);
		return e;
	}



}
